<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-type" content="text/html; charset=utf-8">
		<title>DOH MVC Date Binding Test</title>
		<style type="text/css">
			@import "../../../../dojo/resources/dojo.css";
			@import "../../../../dijit/themes/claro/claro.css";
		</style>
		<script type="text/javascript" data-dojo-config="parseOnLoad:0,isDebug:1,async:1,mvc:{debugBindings:1}" src="../../../../dojo/dojo.js"></script>
		<script type="text/javascript">
			require([
				"doh/runner",
				"dojo/dom",
				"dojo/dom-style",
				"dojo/parser",
				"dojo/Stateful",
				"dojo/date/stamp",
				"dojo/date/locale",
				"dojox/mvc/at",
				"dijit/registry",
				"dijit/CalendarLite",
				"dijit/form/Button",
				"dijit/form/DateTextBox",
				"dijit/form/TextBox",
				"dojox/mvc/EditModelRefController",
				"dojox/mvc/Output",
				"dojo/domReady!"
			], function(doh, ddom, domStyle, parser, Stateful, dateStamp, dateLocale, at, registry, Calendar, Button, DateTextBox, TextBox, EditModelRefController, Output){

				parser.parse();

				var dummyDateWid = new DateTextBox({constraints:{datePattern:"MM-dd-yyyy h:mm a", strict:true}});

				// *** Test1 setup begin: ***
				test1_ctrl = new EditModelRefController({sourceModel: new Stateful({date: new Date(1987, 7, 1, 1, 0, 0, 0)})}); // Sets the time to 1am, see dijit._CalendarList._patchDate()

				var test1_cal = new Calendar({value: at(test1_ctrl, "date")}, ddom.byId("test1_cal"));
				test1_cal.startup();

				var test1_cal2 = new Calendar({value: at(test1_ctrl, "date")}, ddom.byId("test1_cal2"));
				test1_cal2.startup();

				var test1_txt2 = new TextBox({value: at(test1_ctrl, "date").transform(dummyDateWid.dateLocaleModule), constraints: dummyDateWid.constraints}, ddom.byId("test1_txt2"));
				domStyle.set(test1_txt2.domNode, "width", "368px");
				test1_txt2.startup();

				var test1_out2 = new Output({value: at(test1_ctrl, "date").transform(dummyDateWid.dateLocaleModule), 
					constraints: dummyDateWid.constraints}, ddom.byId("test1_output2"));
				test1_out2.startup();

				var test1_setday2 = new Button({
					label: "Set Calendar to Sep 7 1989",
					onClick: function() {
						var day2 = new Date(1989, 8, 7, 1, 0, 0, 0); // Sets the time to 1am, see dijit._CalendarList._patchDate()
						test1_cal2.set("value", day2);
					}
				}, ddom.byId("test1_setdate1"));
				test1_setday2.startup();

				var test1_settext2 = new Button({
					label: "Set TextBox to May 5, 1991",
					onClick: function() {
						test1_txt2.set("value", dateLocale.format(new Date(1991, 4, 5, 1, 0, 0, 0), {datePattern: "MM-dd-yyyy h:mm a", selector: "date"})); // Sets the time to 1am, see dijit._CalendarList._patchDate()
					}
				}, ddom.byId("test1_setdate2"));
				test1_settext2.startup();

				var test1_settext3 = new Button({
					label: "Set TextBox to Nov 6, 2011",
					onClick: function() {
						test1_txt2.set("value", dateLocale.format(new Date(2011, 10, 7, 1, 0, 0, 0), {datePattern: "MM-dd-yyyy h:mm a", selector: "date"}));						
					}
				}, ddom.byId("test1_setdate3"));
				test1_settext3.startup();

				var test1_reset2 = new Button({
					label: "Reset Calendar back to Aug 1 1987",
					onClick: function() {
						test1_ctrl.reset();
					}
				}, ddom.byId("test1_reset2"));
				test1_reset2.startup();
				// *** Test1 setup end: ***

				// *** Test2 setup begin: ***
				test2_ctrl = new EditModelRefController({sourceModel: new Stateful({date: new Date(2011, 10, 6, 1, 0, 0, 0)})}); // Sets the time to 1am, see dijit._CalendarList._patchDate()
				var test2_cal = new DateTextBox({value: at(test2_ctrl, "date")}, ddom.byId("test2_cal"));
				test2_cal.startup();

				var test2_cal2 = new DateTextBox({value: at(test2_ctrl, "date")}, ddom.byId("test2_cal2"));
				test2_cal2.startup();

				var test2_txt2 = new TextBox({value: at(test2_ctrl, "date").transform(dummyDateWid.dateLocaleModule), constraints: dummyDateWid.constraints}, ddom.byId("test2_txt2"));
				domStyle.set(test2_txt2.domNode, "width", "368px");
				test2_txt2.startup();

				var test2_out2 = new Output({value: at(test2_ctrl, "date").transform(dummyDateWid.dateLocaleModule), 
					constraints: dummyDateWid.constraints}, ddom.byId("test2_output2"));
				test2_out2.startup();

				var test2_setday2 = new Button({
					label: "Set DateTextBox to Oct 28, 1993",
					onClick: function() {
						var day2 = dateLocale.format(new Date(1993, 9, 28, 1, 0, 0, 0), {datePattern: "MM-dd-yyyy h:mm a", selector: "date"}); // Sets the time to 1am, see dijit._CalendarList._patchDate()
						test2_txt2.set("value", day2);
					}
				}, ddom.byId("test2_setdate1"));
				test2_setday2.startup();

				var test2_settext2 = new Button({
					label: "Set DateTextBox to Oct 14 1997",
					onClick: function() {
						test2_txt2.set("value", dateLocale.format(new Date(1997, 9, 14, 1, 0, 0, 0), {datePattern: "MM-dd-yyyy h:mm a", selector: "date"}));						
					}
				}, ddom.byId("test2_setdate2"));
				test2_settext2.startup();

				var test2_reset2 = new Button({
					label: "Reset DateTextBox back to Nov 6 2011",
					onClick: function() {
						test2_ctrl.reset();
					}
				}, ddom.byId("test2_reset2"));

				var test2_settext3 = new Button({
					label: "Set TextBox to May 5, 1991",
					onClick: function() {
						test2_txt2.set("value", dateLocale.format(new Date(1991, 4, 5, 1, 0, 0, 0), {datePattern: "MM-dd-yyyy h:mm a", selector: "date"}));						
					}
				}, ddom.byId("test2_setdate3"));
				test2_settext3.startup();

				test2_reset2.startup();
				// *** Test2 setup end: ***

				// *** Test3 setup begin: ***
				var test3_init = new Date(2011, 7, 27, 1, 0, 0, 0); // Sets the time to 1am, see dijit._CalendarList._patchDate()
				test3_ctrl = new EditModelRefController({sourceModel: new Stateful({date: test3_init})});

				var test3_cal = new Calendar({value: at(test3_ctrl, "date")}, ddom.byId("test3_cal"));
				test3_cal.startup();

				var test3_cal2 = new DateTextBox({value: at(test3_ctrl, "date")}, ddom.byId("test3_cal2"));
				test3_cal2.startup();

				var test3_txt2 = new TextBox({
					value: at(test3_ctrl, "date").transform(dummyDateWid.dateLocaleModule),
					constraints: dummyDateWid.constraints,
					disabled: true
				}, ddom.byId("test3_txt2"));
				domStyle.set(test3_txt2.domNode, "width", "368px");
				test3_txt2.startup();

				var test3_out2 = new Output({value: at(test3_ctrl, "date").transform(dummyDateWid.dateLocaleModule), 
					constraints: dummyDateWid.constraints}, ddom.byId("test3_output2"));
				test3_out2.startup();

				var test3_setday2 = new Button({
					label: "Set Calendar to Oct 14 1997",
					onClick: function() {
						var day2 = new Date(1997, 9, 14, 1, 0, 0, 0); // Sets the time to 1am, see dijit._CalendarList._patchDate()
						test3_cal2.set("value", day2);
					}
				}, ddom.byId("test3_setdate1"));
				test3_setday2.startup();

				var test3_settext2 = new Button({
					label: "Set TextBox to Nov 6, 2011",
					onClick: function() {
						test3_txt2.set("value", dateLocale.format(new Date(2011, 10, 6, 1, 0, 0, 0), {datePattern: "MM-dd-yyyy h:mm a", selector: "date"})); // Sets the time to 1am, see dijit._CalendarList._patchDate()
					}
				}, ddom.byId("test3_setdate2"));
				test3_settext2.startup();

				var test3_settext3 = new Button({
					label: "Set TextBox to May 5, 1991",
					onClick: function() {
						var d = dateLocale.format(new Date(1991, 4, 5, 1, 0, 0, 0), {datePattern: "MM-dd-yyyy h:mm a", selector: "date"}); // Sets the time to 1am, see dijit._CalendarList._patchDate()
						test3_txt2.set("value", d); // 5/5/1991 YYYY-MM-DDThh:mm:ss via new Date
					}
				}, ddom.byId("test3_setdate3"));
				test3_settext3.startup();

				var test3_reset2 = new Button({
					label: "Reset Calendar back to Aug 27 2011",
					onClick: function() {
						test3_ctrl.reset();
					}
				}, ddom.byId("test3_reset2"));
				test3_reset2.startup();
				// *** Test3 setup end: ***

				// *** Test4 setup begin: RegExp Test***
				test4_ctrl = new EditModelRefController({sourceModel: new Stateful({regex: /abc/i})});
				// *** Test4 setup end: ***

				// *** Test5 setup begin: Falsy Test***
				test5_model = new Stateful({
					u: void 0,
					z: 0,
					n: null,
					f: false,
					s: ""
				});
				// *** Test5 setup end: ***

				doh.register("Check initial values and bindings", [{
					name: "Initial-test1",
					runTest: function(){
						doh.is("1987", registry.byId("test1_cal").get("value").getFullYear(),"test1_cal getFullYear should be 1987");
						doh.is("7", registry.byId("test1_cal").get("value").getMonth(),"test1_cal getMonth should be 7");
						doh.is("1", registry.byId("test1_cal").get("value").getDate(),"test1_cal getDate should be 1");
						doh.is("1987", registry.byId("test1_cal2").get("value").getFullYear(),"test1_cal2 getFullYear should be 1987");
						doh.is("7", registry.byId("test1_cal2").get("value").getMonth(),"test1_cal2 getMonth should be 7");
						doh.is("1", registry.byId("test1_cal2").get("value").getDate(),"test1_cal2 getDate should be 1");
						doh.is("08-01-1987 1:00 AM", registry.byId("test1_txt2").get("value"), "test1_txt2 should be 08-01-1987 1:00 AM");
						doh.is("08-01-1987 1:00 AM", registry.byId("test1_output2").get("value"), "test1_output2 should be 08-01-1987 1:00 AM");
					}
				}, {
					name: "Initial-test2",
					runTest: function(){
						doh.is("2011", registry.byId("test2_cal").get("value").getFullYear(),"test2_cal getFullYear should be 1987");
						doh.is("10", registry.byId("test2_cal").get("value").getMonth(),"test2_cal getMonth should be 10");
						doh.is("6", registry.byId("test2_cal").get("value").getDate(),"test2_cal getDate should be 6");
						doh.is("2011", registry.byId("test2_cal2").get("value").getFullYear(),"test2_cal2 getFullYear should be 1987");
						doh.is("10", registry.byId("test2_cal2").get("value").getMonth(),"test2_cal2 getMonth should be 10");
						doh.is("6", registry.byId("test2_cal2").get("value").getDate(),"test2_cal2 getDate should be 6");
						doh.is("11-06-2011 1:00 AM", registry.byId("test2_txt2").get("value"), "test2_txt2 should be 11-06-2011 1:00 AM");
						doh.is("11-06-2011 1:00 AM", registry.byId("test2_output2").get("value"), "test2_output2 should be 11-06-2011 1:00 AM");
					}
				}, {
					name: "Initial-test3",
					runTest: function(){
						doh.is("2011", registry.byId("test3_cal").get("value").getFullYear(),"test3_cal getFullYear should be 1987");
						doh.is("7", registry.byId("test3_cal").get("value").getMonth(),"test3_cal getMonth should be 7");
						doh.is("27", registry.byId("test3_cal").get("value").getDate(),"test3_cal getDate should be 27");
						doh.is("2011", registry.byId("test3_cal2").get("value").getFullYear(),"test3_cal2 getFullYear should be 1987");
						doh.is("7", registry.byId("test3_cal2").get("value").getMonth(),"test3_cal2 getMonth should be 7");
						doh.is("27", registry.byId("test3_cal2").get("value").getDate(),"test3_cal2 getDate should be 27");
						doh.is("08-27-2011 1:00 AM", registry.byId("test3_txt2").get("value"), "test3_txt2 should be 08-27-2011 1:00 AM");
						doh.is("08-27-2011 1:00 AM", registry.byId("test3_output2").get("value"), "test3_output2 should be 08-27-2011 1:00 AM");
					}
				}]);

				doh.register("Update first cal", [{
					name: "Update-First-Cal-test1",
					runTest: function(){
						var day2 = new Date(1989, 8, 7, 1, 0, 0, 0); // 9/7/1989 (Sets the time to 1am, see dijit._CalendarList._patchDate())
						registry.byId(test1_cal).set("value", day2);
						doh.is("1989", registry.byId("test1_cal").get("value").getFullYear(),"test1_cal getFullYear should be 1989");
						doh.is("8", registry.byId("test1_cal").get("value").getMonth(),"test1_cal getMonth should be 8");
						doh.is("7", registry.byId("test1_cal").get("value").getDate(),"test1_cal getDate should be 7");
						doh.is("1989", registry.byId("test1_cal2").get("value").getFullYear(),"test1_cal2 getFullYear should be 1989");
						doh.is("8", registry.byId("test1_cal2").get("value").getMonth(),"test1_cal2 getMonth should be 8");
						doh.is("7", registry.byId("test1_cal2").get("value").getDate(),"test1_cal2 getDate should be 7");
						doh.is("09-07-1989 1:00 AM", registry.byId("test1_txt2").get("value"), "test1_txt2 should be 09-07-1989 1:00 AM");
						doh.is("09-07-1989 1:00 AM", registry.byId("test1_output2").get("value"), "test1_output2 should be 09-07-1989 1:00 AM");
					}
				}, {
					name: "Update-First-Cal-test2",
					runTest: function(){
						var day2 = new Date(1989, 8, 7, 1, 0, 0, 0); // 9/7/1989 (Sets the time to 1am, see dijit._CalendarList._patchDate())
						registry.byId(test2_cal).set("value", day2);
						doh.is("1989", registry.byId("test2_cal").get("value").getFullYear(),"test2_cal getFullYear should be 1989");
						doh.is("8", registry.byId("test2_cal").get("value").getMonth(),"test2_cal getMonth should be 8");
						doh.is("7", registry.byId("test2_cal").get("value").getDate(),"test2_cal getDate should be 7");
						doh.is("1989", registry.byId("test2_cal2").get("value").getFullYear(),"test2_cal2 getFullYear should be 1989");
						doh.is("8", registry.byId("test2_cal2").get("value").getMonth(),"test2_cal2 getMonth should be 8");
						doh.is("7", registry.byId("test2_cal2").get("value").getDate(),"test2_cal2 getDate should be 7");
						doh.is("09-07-1989 1:00 AM", registry.byId("test2_txt2").get("value"), "test2_txt2 should be 09-07-1989 1:00 AM");
						doh.is("09-07-1989 1:00 AM", registry.byId("test2_output2").get("value"), "test2_output2 should be 09-07-1989 1:00 AM");
					}
				}, {
					name: "Update-First-Cal-test3",
					runTest: function(){
						var day2 = new Date(1989, 8, 7, 1, 0, 0, 0); // 9/7/1989 (Sets the time to 1am, see dijit._CalendarList._patchDate())
						registry.byId(test3_cal).set("value", day2);
						doh.is("1989", registry.byId("test3_cal").get("value").getFullYear(),"test3_cal getFullYear should be 1989");
						doh.is("8", registry.byId("test3_cal").get("value").getMonth(),"test3_cal getMonth should be 8");
						doh.is("7", registry.byId("test3_cal").get("value").getDate(),"test3_cal getDate should be 7");
						doh.is("1989", registry.byId("test3_cal2").get("value").getFullYear(),"test3_cal2 getFullYear should be 1989");
						doh.is("8", registry.byId("test3_cal2").get("value").getMonth(),"test3_cal2 getMonth should be 8");
						doh.is("7", registry.byId("test3_cal2").get("value").getDate(),"test3_cal2 getDate should be 7");
						doh.is("09-07-1989 1:00 AM", registry.byId("test3_txt2").get("value"), "test3_txt2 should be 09-07-1989 1:00 AM");
						doh.is("09-07-1989 1:00 AM", registry.byId("test3_output2").get("value"), "test3_output2 should be 09-07-1989 1:00 AM");
					}
				}]);

				doh.register("Update textbox", [{
					name: "Update-TextBox-test1",
					runTest: function(){
						registry.byId(test1_txt2).set("value", "05-05-1991 1:00 AM");
						doh.is("1991", registry.byId("test1_cal").get("value").getFullYear(),"test1_cal getFullYear should be 1991");
						doh.is("4", registry.byId("test1_cal").get("value").getMonth(),"test1_cal getMonth should be 4");
						doh.is("5", registry.byId("test1_cal").get("value").getDate(),"test1_cal getDate should be 4");
						doh.is("1991", registry.byId("test1_cal2").get("value").getFullYear(),"test1_cal2 getFullYear should be 1991");
						doh.is("4", registry.byId("test1_cal2").get("value").getMonth(),"test1_cal2 getMonth should be 4");
						doh.is("5", registry.byId("test1_cal2").get("value").getDate(),"test1_cal2 getDate should be 5");
						doh.is("05-05-1991 1:00 AM", registry.byId("test1_txt2").get("value"), "test1_txt2 should be 05-05-1991 1:00 AM");
						doh.is("05-05-1991 1:00 AM", registry.byId("test1_output2").get("value"), "test1_output2 should be 05-05-1991 1:00 AM");
					}
				}, {
					name: "Update-TextBox-test2",
					runTest: function(){
						registry.byId(test2_txt2).set("value", "05-05-1991 1:00 AM");
						doh.is("1991", registry.byId("test2_cal").get("value").getFullYear(),"test2_cal getFullYear should be 1991");
						doh.is("4", registry.byId("test2_cal").get("value").getMonth(),"test2_cal getMonth should be 4");
						doh.is("5", registry.byId("test2_cal").get("value").getDate(),"test2_cal getDate should be 4");
						doh.is("1991", registry.byId("test2_cal2").get("value").getFullYear(),"test2_cal2 getFullYear should be 1991");
						doh.is("4", registry.byId("test2_cal2").get("value").getMonth(),"test2_cal2 getMonth should be 4");
						doh.is("5", registry.byId("test2_cal2").get("value").getDate(),"test2_cal2 getDate should be 5");
						doh.is("05-05-1991 1:00 AM", registry.byId("test2_txt2").get("value"), "test2_txt2 should be 05-05-1991 1:00 AM");
						doh.is("05-05-1991 1:00 AM", registry.byId("test2_output2").get("value"), "test2_output2 should be 05-05-1991 1:00 AM");
					}
				}, {
					name: "Update-TextBox-test3",
					runTest: function(){
						registry.byId(test3_txt2).set("value", "05-05-1991 1:00 AM");
						doh.is("1991", registry.byId("test3_cal").get("value").getFullYear(),"test3_cal getFullYear should be 1991");
						doh.is("4", registry.byId("test3_cal").get("value").getMonth(),"test3_cal getMonth should be 4");
						doh.is("5", registry.byId("test3_cal").get("value").getDate(),"test3_cal getDate should be 4");
						doh.is("1991", registry.byId("test3_cal2").get("value").getFullYear(),"test3_cal2 getFullYear should be 1991");
						doh.is("4", registry.byId("test3_cal2").get("value").getMonth(),"test3_cal2 getMonth should be 4");
						doh.is("5", registry.byId("test3_cal2").get("value").getDate(),"test3_cal2 getDate should be 5");
						doh.is("05-05-1991 1:00 AM", registry.byId("test3_txt2").get("value"), "test3_txt2 should be 05-05-1991 1:00 AM");
						doh.is("05-05-1991 1:00 AM", registry.byId("test3_output2").get("value"), "test3_output2 should be 05-05-1991 1:00 AM");
					}
				}]);

				doh.register("Update cal with new date", [{
					name: "Update-withNewDate-test1",
					runTest: function(){
						var day2 = new Date(1993, 9, 28, 1, 0, 0, 0);  // 10/28/1993
						var test = day2.toDateString();
						var startTime3 = (new Date()).getTime();
						registry.byId(test1_cal).set("value", day2);
						doh.is("1993", registry.byId("test1_cal").get("value").getFullYear(),"test1_cal getFullYear should be 1993");
						doh.is("9", registry.byId("test1_cal").get("value").getMonth(),"test1_cal getMonth should be 9");
						doh.is("28", registry.byId("test1_cal").get("value").getDate(),"test1_cal getDate should be 28");
						doh.is("1993", registry.byId("test1_cal2").get("value").getFullYear(),"test1_cal2 getFullYear should be 1993");
						doh.is("9", registry.byId("test1_cal2").get("value").getMonth(),"test1_cal2 getMonth should be 9");
						doh.is("28", registry.byId("test1_cal2").get("value").getDate(),"test1_cal2 getDate should be 28");
						doh.is("10-28-1993 1:00 AM", registry.byId("test1_txt2").get("value"), "test1_txt2 should be 10-28-1993 1:00 AM");
						doh.is("10-28-1993 1:00 AM", registry.byId("test1_output2").get("value"), "test1_output2 should be 10-28-1993 1:00 AM");
					}
				}, {
					name: "Update-withNewDate-test2",
					runTest: function(){
						var day2 = new Date(1993, 9, 28, 1, 0, 0, 0);  // 10/28/1993
						registry.byId(test2_cal).set("value", day2);
						doh.is("1993", registry.byId("test2_cal").get("value").getFullYear(),"test2_cal getFullYear should be 1993");
						doh.is("9", registry.byId("test2_cal").get("value").getMonth(),"test2_cal getMonth should be 9");
						doh.is("28", registry.byId("test2_cal").get("value").getDate(),"test2_cal getDate should be 28");
						doh.is("1993", registry.byId("test2_cal2").get("value").getFullYear(),"test2_cal2 getFullYear should be 1993");
						doh.is("9", registry.byId("test2_cal2").get("value").getMonth(),"test2_cal2 getMonth should be 9");
						doh.is("28", registry.byId("test2_cal2").get("value").getDate(),"test2_cal2 getDate should be 28");
						doh.is("10-28-1993 1:00 AM", registry.byId("test2_txt2").get("value"), "test2_txt2 should be 10-28-1993 1:00 AM");
						doh.is("10-28-1993 1:00 AM", registry.byId("test2_output2").get("value"), "test2_output2 should be 10-28-1993 1:00 AM");
					}
				}, {
					name: "Update-withNewDate-test3",
					runTest: function(){
						var day2 = new Date(1993, 9, 28, 1, 0, 0, 0);  // 10/28/1993
						registry.byId(test3_cal).set("value", day2);
						doh.is("1993", registry.byId("test3_cal").get("value").getFullYear(),"test3_cal getFullYear should be 1993");
						doh.is("9", registry.byId("test3_cal").get("value").getMonth(),"test3_cal getMonth should be 9");
						doh.is("28", registry.byId("test3_cal").get("value").getDate(),"test3_cal getDate should be 28");
						doh.is("1993", registry.byId("test3_cal2").get("value").getFullYear(),"test3_cal2 getFullYear should be 1993");
						doh.is("9", registry.byId("test3_cal2").get("value").getMonth(),"test3_cal2 getMonth should be 9");
						doh.is("28", registry.byId("test3_cal2").get("value").getDate(),"test3_cal2 getDate should be 28");
						doh.is("10-28-1993 1:00 AM", registry.byId("test3_txt2").get("value"), "test3_txt2 should be 10-28-1993 1:00 AM");
						doh.is("10-28-1993 1:00 AM", registry.byId("test3_output2").get("value"), "test3_output2 should be 10-28-1993 1:00 AM");
					}
				}]);

				doh.register("Check model reset", [{
					name: "Reset-test1",
					runTest: function(){
						test1_ctrl.reset();
						doh.is("1987", registry.byId("test1_cal").get("value").getFullYear(),"test1_cal getFullYear should be 1987");
						doh.is("7", registry.byId("test1_cal").get("value").getMonth(),"test1_cal getMonth should be 7");
						doh.is("1", registry.byId("test1_cal").get("value").getDate(),"test1_cal getDate should be 1");
						doh.is("1987", registry.byId("test1_cal2").get("value").getFullYear(),"test1_cal2 getFullYear should be 1987");
						doh.is("7", registry.byId("test1_cal2").get("value").getMonth(),"test1_cal2 getMonth should be 7");
						doh.is("1", registry.byId("test1_cal2").get("value").getDate(),"test1_cal2 getDate should be 1");
						doh.is("08-01-1987 1:00 AM", registry.byId("test1_txt2").get("value"), "test1_txt2 should be 08-01-1987 1:00 AM");
						doh.is("08-01-1987 1:00 AM", registry.byId("test1_output2").get("value"), "test1_output2 should be 08-01-1987 1:00 AM");
					}
				}, {
					name: "Reset-test2",
					runTest: function(){
						test2_ctrl.reset();
						doh.is("2011", registry.byId("test2_cal").get("value").getFullYear(),"test2_cal getFullYear should be 1987");
						doh.is("10", registry.byId("test2_cal").get("value").getMonth(),"test2_cal getMonth should be 10");
						doh.is("6", registry.byId("test2_cal").get("value").getDate(),"test2_cal getDate should be 6");
						doh.is("2011", registry.byId("test2_cal2").get("value").getFullYear(),"test2_cal2 getFullYear should be 1987");
						doh.is("10", registry.byId("test2_cal2").get("value").getMonth(),"test2_cal2 getMonth should be 10");
						doh.is("6", registry.byId("test2_cal2").get("value").getDate(),"test2_cal2 getDate should be 6");
						doh.is("11-06-2011 1:00 AM", registry.byId("test2_txt2").get("value"), "test2_txt2 should be 11-06-2011 1:00 AM");
						doh.is("11-06-2011 1:00 AM", registry.byId("test2_output2").get("value"), "test2_output2 should be 11-06-2011 1:00 AM");
					}
				}, {
					name: "Reset-test3",
					runTest: function(){
						test3_ctrl.reset();
						doh.is("2011", registry.byId("test3_cal").get("value").getFullYear(),"test3_cal getFullYear should be 1987");
						doh.is("7", registry.byId("test3_cal").get("value").getMonth(),"test3_cal getMonth should be 7");
						doh.is("27", registry.byId("test3_cal").get("value").getDate(),"test3_cal getDate should be 27");
						doh.is("2011", registry.byId("test3_cal2").get("value").getFullYear(),"test3_cal2 getFullYear should be 1987");
						doh.is("7", registry.byId("test3_cal2").get("value").getMonth(),"test3_cal2 getMonth should be 7");
						doh.is("27", registry.byId("test3_cal2").get("value").getDate(),"test3_cal2 getDate should be 27");
						doh.is("08-27-2011 1:00 AM", registry.byId("test3_txt2").get("value"), "test3_txt2 should be 08-27-2011 1:00 AM");
						doh.is("08-27-2011 1:00 AM", registry.byId("test3_output2").get("value"), "test3_output2 should be 08-27-2011 1:00 AM");
					}
				}]);

				doh.register("Test misc in model", [{
					name: "Regexp-test4",
					runTest: function(){
						doh.is("/abc/i", test4_ctrl.get("regex"),"test4_ctrl.get(\"regex\") should be /abc/i");
						var str = "ABCDEFGHIJKLMNOP abcdefghi";
						var patt1 = test4_ctrl.get("regex");
						doh.is("ABC", str.match(test4_ctrl.get("regex")),"str.match(test4_ctrl.get(\"regex\")) should be ABC");
						doh.is("ABC", str.match(patt1),"str.match(patt1) should be ABC");
						test4_ctrl.set("regex",/def/);
						doh.is("def", str.match(test4_ctrl.get("regex")),"str.match(test4_ctrl.get(\"regex\")) after set /def/ should be def");
						test4_ctrl.reset();
						doh.is("ABC", str.match(test4_ctrl.get("regex")),"str.match(test4_ctrl.get(\"regex\")) after reset should be ABC");
					}
				}, {
					name: "Falsy-test5",
					runTest: function(){
						doh.t(null === test5_model.get("n"),"test5_model.get(\"n\") should be null");
						doh.t(0 === test5_model.get("z"),"test5_model.get(\"z\") should be 0");
						doh.t(undefined === test5_model.get("u"),"test5_model.get(\"u\") should be undefined");
						doh.t(false === test5_model.get("f"),"test5_model.f.get(\"f\") should be false");
						doh.t("" === test5_model.get("s"),"test5_model.s.get(\"s\") should be an empty string");
					}
				}]);

				doh.run();
			});
		</script>
	</head>
	<body class="claro">
		<h2>Test 1: Two Calendars bound to each other, a TextBox and an mvc Output field.</h2>
			<div  style="border-style: solid; border-width: 2px; width: 827px;">
				<table>
					<tbody>
						<tr>
							<td><div id="test1_cal"></div></td>
							<td><div id="test1_cal2"></div></td>
							<td>
								<table>
									<tbody>
										<tr><td><label for="test1_txt2">TextBox bound to date:</label></td></tr>
										<tr><td><div id="test1_txt2"></div></td></tr>
										<tr><td><label for="test1_txt2">MVC Output bound to date:</label></td></tr>
										<tr><td><div id="test1_output2"></div></td></tr>
									</tbody>
								</table>
								<table>
									<tbody>
										<tr>
											<td><div id="test1_setdate1"></div></td>
										</tr>
									</tbody>
								</table>
								<table>
									<tbody>
										<tr>
											<td><div id="test1_setdate2"></div></td>
										</tr>
									</tbody>
								</table>
								<table>
									<tbody>
										<tr>
											<td><div id="test1_setdate3"></div></td>
										</tr>
									</tbody>
								</table>
								<table>
									<tbody>
										<tr>
											<td><div id="test1_reset2"></div></td>
										</tr>
									</tbody>
								</table>
							</td>
						</tr>
					</tbody>
				</table>
			</div>

		<h2>Test 2: Two DateTextBoxes bound to each other, a TextBox and an mvc Output field.</h2>
			<div  style="border-style: solid; border-width: 2px; width: 827px;">
				<table>
					<tbody>
						<tr>
							<td style="vertical-align: top;"><div id="test2_cal"></div></td>
							<td style="vertical-align: top;"><div id="test2_cal2"></div></td>
							<td>
								<table>
									<tbody>
										<tr><td><label for="test2_txt2">TextBox bound to date:</label></td></tr>
										<tr><td><div id="test2_txt2"></div></td></tr>
										<tr><td><label for="test2_txt2">MVC Output bound to date:</label></td></tr>
										<tr><td><div id="test2_output2"></div></td></tr>
									</tbody>
								</table>
								<table>
									<tbody>
										<tr>
											<td><div id="test2_setdate1"></div></td>
										</tr>
									</tbody>
								</table>
								<table>
									<tbody>
										<tr>
											<td><div id="test2_setdate2"></div></td>
										</tr>
									</tbody>
								</table>
								<table>
									<tbody>
										<tr>
											<td><div id="test2_setdate3"></div></td>
										</tr>
									</tbody>
								</table>
								<table>
									<tbody>
										<tr>
											<td><div id="test2_reset2"></div></td>
										</tr>
									</tbody>
								</table>
							</td>
						</tr>
					</tbody>
				</table>
			</div>
		<h2>Test 3: One Calendar bound to a DateTextbox, a TextBox and an mvc Output field.</h2>
			<div  style="border-style: solid; border-width: 2px; width: 827px;">
				<table>
					<tbody>
						<tr>
							<td style="vertical-align: top;"><div id="test3_cal"></div></td>
							<td style="vertical-align: top;"><div id="test3_cal2"></div></td>
							<td>
								<table>
									<tbody>
										<tr><td><label for="test3_txt2">TextBox bound to date: (disabled to avoid error)</label></td></tr>
										<tr><td><div id="test3_txt2"></div></td></tr>
										<tr><td><label for="test3_txt2">MVC Output bound to date:</label></td></tr>
										<tr><td><div id="test3_output2"></div></td></tr>
									</tbody>
								</table>
								<table>
									<tbody>
										<tr>
											<td><div id="test3_setdate1"></div></td>
										</tr>
									</tbody>
								</table>
								<table>
									<tbody>
										<tr>
											<td><div id="test3_setdate2"></div></td>
										</tr>
									</tbody>
								</table>
								<table>
									<tbody>
										<tr>
											<td><div id="test3_setdate3"></div></td>
										</tr>
									</tbody>
								</table>
								<table>
									<tbody>
										<tr>
											<td><div id="test3_reset2"></div></td>
										</tr>
									</tbody>
								</table>
							</td>
						</tr>
					</tbody>
				</table>
			</div>
	</body>
</html>
